package com.lrd.rmq514version.rmq.web;

import com.lrd.rmq514version.rmq.service.RmqService;
import com.lrd.rmq514version.rmq.vo.SendMoreDelayTimeMsgVo;
import com.lrd.rmq514version.rmq.vo.SendOneDelayTimeMsgVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/rmq")
public class RMqController {

    @Autowired
    private RmqService rmqService;

    /**
     * 发送一条
     */
    @PostMapping("/sendDelayTimeMessage")
    public String sendDelayTimeMessage(@RequestBody SendOneDelayTimeMsgVo sendOneDelayTimeMsgVo) {
        return rmqService.sendDelayTimeMessage(sendOneDelayTimeMsgVo);
    }

    /**
     * 使用循环批量发送
     */
    @PostMapping("/sendMoreDelayTimeMessage")
    public String sendMoreDelayTimeMessage(@RequestBody SendMoreDelayTimeMsgVo sendMoreDelayTimeMsgVo) {
        return rmqService.sendMoreDelayTimeMessage(sendMoreDelayTimeMsgVo);
    }
}
